package com.huan.springcloud.functions;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.system.ApplicationPid;
import org.springframework.stereotype.Component;

/**
 * 获取程序的 pid 值
 *
 * @author huan.fu
 * @date 2025/6/30 - 22:20
 */
@Component
public class GetApplicationPid implements ApplicationRunner {

    private static final Logger log = LoggerFactory.getLogger(GetApplicationPid.class);

    @Override
    public void run(ApplicationArguments args) throws Exception {
        ApplicationPid pid = new ApplicationPid();
        log.info("当前程序的pid为: {}", pid);
    }
}
